package com.kkshop.gwt.widget.wizard;

import com.google.gwt.user.client.ui.Widget;

public interface WizardPage {

	/**
	 * should return the widget (and initialize it if necessary)
	 * 
	 * @return the widget to be used.
	 */
	public Widget createWidget();

	/**
	 * Returns the pages name (title)
	 * 
	 * @return the pages name
	 */
	public String getName();

	/**
	 * This is the way to check a wizard page for errors. Should either return
	 * an appropriate error message which can be displayed to the user, or
	 * 'null' if no error occurred.
	 * 
	 * @return error message or null.
	 */
	public String getErrorMessage();

	/**
	 * Should return true if this page is completed and the user should be a
	 * able to flip to the next page. (This is usually the same as
	 * {@link #isFinished()})
	 * 
	 * @return true if user filled out page.
	 */
	public boolean canFlipToNextPage();

	/**
	 * Determine if this wizard page is finished.
	 * 
	 * @return true if this wizard page is finished.
	 */
	public boolean isFinished();

	/**
	 * 
	 * @return the wizard this page is used in.
	 */
	public Wizard getWizard();

	/**
	 * Should be called by the Wizard once it adds this page.
	 * 
	 * @param wizard
	 */
	public void setWizard(Wizard wizard);
}
